<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        a{
            position: absolute;
            top: 400px;
        }
        .prev{
            left: 100px;
        }
        .next{
            left: 200px;
        }
    </style>
</head>
<body>
    <div id="app">
        <a href="javascript:;" class="prev" @click="prev" v-show="index!=0">左</a>
        <a href="javascript:;" class="next" @click="next" v-show="index<imgList.length-1">右</a>
        <img :src="imgList[index]" >
    </div>
    <script>
        var app = new Vue({
            el:"#app",
            data:{
                imgList:[  
                    "img/1.jpg",
                    "img/2.jpg",
                    "img/3.jpg",
                    "img/4.jpg",
                    "img/5.jpg"
                ],
                index:0
            },
            methods:{
                prev:function(){
                    this.index--;
                },
                next:function(){
                    this.index++;
                },
            }
        })
    </script>
</body>
</html>